//
//  CZCommentTopView.swift
//  GZWeibo666
//
//  Created by Yuan on 15/12/2.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit
protocol commenTopViewdelegate : NSObjectProtocol {
    func commTopButtonClick()
}
class CZCommentTopView: UIView {
    //代理属性
    weak var delegate: commenTopViewdelegate?
    
    //评论数
    var comment : Int = 0
    
    /// 评论按钮
    private lazy var commentButton: UIButton = {
        print("lazy")
        let button = UIButton(imageName: "timeline_icon_comment", title: "评论\(self.comment)")
        
        button.addTarget(self, action: "commentButtonClick", forControlEvents: UIControlEvents.TouchUpInside)
        
        return button
        }()


    func commentButtonClick() {
        
        print("点击了评论按钮")
        delegate!.commTopButtonClick()
    }
    

    init(comment_count : Int) {
        super.init(frame: CGRectZero)
        self.comment = comment_count
        prepareUI()
    }
    func prepareUI(){
        //设置背景颜色
        backgroundColor = UIColor.orangeColor()
        //添加按钮
        addSubview(commentButton)

        

        //分割线
        commentButton.ff_AlignInner(type: ff_AlignType.CenterLeft, referView: self, size: CGSize(width: 70, height: 44))

    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }


}

